import sched
import time


def long_event(name):
    print('Begin Event：', time.time(), name)
    time.sleep(2)
    print('Finish Event：', time.time(), name)


print('Start：', time.time())

# 生成调度器
sche = sched.scheduler(time.time, time.sleep)

# 事件无法在设想的3秒后执行，将会顺延执行
sche.enter(2, 1, long_event, ('first',))
sche.enter(3, 1, long_event, ('second',))

# 运行调度器
sche.run()
